/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package dijkstra;

/**
 *
 * @author luisorozco
 */

// *


import java.util.Iterator;
//import java.util.SinglyLinkedList;
import java.util.LinkedList;

public class Graph<T> extends AbsGraph<T>{

    private int[] valuex;
    private Object[] path;
    private boolean[] check;


    public Graph() {
        super();
    }

    @Override
    public void addNode(T id) {
        if (this.getMap().contains(id)) {
            System.out.println("ERROR \n");
        } else {
            this.map.add(id);
            this.list.add(new LinkedList<Node<Integer>>());
        }
    }

    @Override
    public void addLink(T origen, T destino, Integer peso) {
        int temp = this.getMap().indexOf(origen);
        Node<Integer> temp2 = new Node<Integer>(destino.toString(), peso);

        if (this.map.contains(origen) == false) {
            System.out.println("ERROR: El nodo '" + origen + "' no existe.\n");
        } else if (this.map.contains(destino)) {
            this.list.get(temp).add(temp2);
        } else {
            System.out.println("ERROR: El nodo '" + destino + "' no existe.\n");
        }
    }

    
    

}
